Next | Prev | Up | Top | Contents | Index

Timer Interrupts (Itimers)

IRIX supports the BSD UNIX feature of interval timers or "itimers," and part of the POSIX timer definition.


BSD Itimers

An itimer is a request to have a signal sent at the expiration of a specified interval. In order to use an itimer, you establish a signal handler, then issue the setitimer() call. The timer can be a one-shot or it can repeat at a regular interval (see the setitimer(2) reference page).

There are three itimers (see Table 3-2), only one of which is of interest to a real-time programmer.

Types of itimer
Kind of itimerInterval MeasuredResolutionSignal Sent
ITIMER_REALElapsed clock time1 millisecond or lessSIGALRM
ITIMER_VIRTUALUser time (process execution time)1 secondSIGVTALRM
ITIMER_PROFUser+system time1 secondSIGPROF

The ITIMER_VIRTUAL and ITIMER_PROF timers are not useful to a real-time program because of their coarse precision and because their intervals vary depending on when and how often the process is dispatched. The ITIMER_REAL type measures absolute time, and on the Challenge/Onyx, its resolution can be 500 microseconds or less.

Timers and the resolution of the real-time timer are discussed further in Chapter 5, "Managing Time and Time Intervals." Sample code that sets up an itimer can be found under "Interprocess Communication" in Appendix A.

Note: Interval timers are usually not necessary, and should not be used, under the Frame Scheduler. See "Using Timers with the Frame Scheduler".


POSIX Timers

The POSIX real-time standard 1003.1b-1993 specifies several timer-related functions which it is the intention of Silicon Graphics to support. However, in release 6.2 of IRIX, only the nanosleep() function is implemented (see the nanosleep(2) reference page).

IRIX also supports the POSIX-defined functions alarm() and sleep(). However, since these functions deal with intervals of seconds, they are of less interest to real-time programmers (see alarm(2) and sleep(2) reference pages).

The POSIX functions comparable to setitimer(), such as timer_settime(), will be implemented in a future release.


Next | Prev | Up | Top | Contents | Index